#include <slm/vec2.h>

SLMATH_BEGIN()

void vec2::normalize()
{
	float len = length();
	*this *= 1.f / len;
}


vec2 vec2::rotate(float a )const
{
	float s,c;
	sincos( -a, &s, &c );
	return vec2(x * c + y * s, y * c - x * s);
}

bool equal(const vec2& left, const vec2& right, float tolerance)
{
	return slm::equal(left.x, right.x, tolerance) &&
		slm::equal(left.y, right.y, tolerance);
}

SLMATH_END()

// This file is part of 'slm' C++ library. Copyright (C) 2009 Jani Kajala (kajala@gmail.com). See http://sourceforge.net/projects/slm/
